<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>后台管理系统</title>
	    <meta name="author" content="BaiYY"/>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	    <meta name="renderer" content="webkit">
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css"/>
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/Font/css/font-awesome.min.css"/>
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/index.css"/>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/index.js"></script>
	</head>
	<body>
		
		<!--右边侧栏开始-->
		<div class="right-sidebar" style="max-width: 1200px;">
			<ul class="nav nav-tabs" style="margin-bottom: 16px" role="tablist" id="listTab" class="listTabs">
				<li role="presentation"><a href="initSet.html">{:L(GAME_SETTING_INIT)}</a></li>
				<li role="presentation" id="invited" class="active"><a href="activityInvite.html">{:L(GAME_SETTING_INVITE)}</a></li>
				<li role="presentation" id="roomd"><a href="activityCreateRoom.html">{:L(GAME_SETTING_ROOM)}</a></li>
				<li role="presentation" id="advd"><a href="advSet.html">{:L(GAME_SETTING_ADV)}</a></li>
				<li role="presentation" id="wheeld"><a href="luckWheel.html">{:L(GAME_SERRING_WHEEL)}</a></li>
			</ul>
		
			<div class="alert alert-info" role="alert">设置被邀请者的奖励</div>
		
			<div class="row">
				<div class="col-md-12">
					<div class="input-group">
						<span class="input-group-addon">邀请者奖励</span>
						<input class="form-control" type="number" name="inviter_resource" id="inviter_resource" value="{$inviter_resource}"/>
						<span class="input-group-addon">{:L(GAME_RESOURCE)}</span>
					</div>
					<!--<div class="alert alert-danger hide" role="alert" id="inviter_resource-tips"></div>-->
					<p></p>
					<button type="submit" class="btn btn-primary center-block" id="submit">提交</button>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			$(function () {
                var invited = $.trim($("#invited").text());
                var roomd = $.trim($("#roomd").text());
                var advd = $.trim($("#advd").text());
                var wheeld = $.trim($("#wheeld").text());

                if(invited == '' || invited == 'GAME_SETTING_INVITE') {
                    $("#invited").hide();
                }
                if(roomd == '' || roomd == 'GAME_SETTING_ROOM') {
                    $("#roomd").hide();
                }
                if(advd == '' || advd == 'GAME_SETTING_ADV') {
                    $("#advd").hide();
                }

                if(wheeld == '' || wheeld == 'GAME_SERRING_WHEEL') {
                    $("#wheeld").hide();
                }
            })
			$("#inviter_resource").on('blur',function(){
				var inviter_resource = $.trim($('#inviter_resource').val());
 				if(inviter_resource == '' ) {
 					alert("数值不能为空");
 				}
			});
			$("#submit").on("click",function(){
				var inviter_resource = $.trim($('#inviter_resource').val());
				if(inviter_resource == '' || isNaN(inviter_resource)) {
					alert("请输入争取的数字！");
					return false;
				}
				
				var url="{:U('Admin/Main/activityInviteSave')}";
				$.ajax({
					type:"post",
					url:url,
					dataType:"json",
					data:{'inviter_resource':inviter_resource},
					success:function(data) {
						if(data == 'success') {
							alert("设置成功");
							window.location.href="{:U('Admin/Main/activityInvite')}";
						}else if(data == 'error') {
							alert("设置失败");
						}
					}
				});
			});
		</script>
	</body>
</html>
